package com.zdb.demo.design.pattern.structural.composite;

public class Test {

    public static void main(String[] args) {
        CatalogComponent root = new CourseCatalog("大学课程目录");

        CatalogComponent firstC = new CourseCatalog("第1学期");
        CatalogComponent secondC = new CourseCatalog("第2学期");
        CatalogComponent thirdC = new CourseCatalog("第3学期");

        firstC.add(new Course("java", 100));
        firstC.add(new Course("python", 200));
        firstC.add(new Course("c", 300));

        secondC.add(new Course("语文", 100));
        secondC.add(new Course("数学", 100));
        secondC.add(new Course("英语", 100));

        root.add(firstC);
        root.add(secondC);
        root.add(thirdC);

        root.add(new Course("大学入门", 0));

        root.print();
    }
}
